package com.wl.java_spring_boot01.modules.test.service.impl;

import com.wl.java_spring_boot01.modules.common.vo.Result;
import com.wl.java_spring_boot01.modules.test.entity.Card;
import com.wl.java_spring_boot01.modules.test.repository.CardRepository;
import com.wl.java_spring_boot01.modules.test.service.CardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 汪林
 * @date 2020/8/12 22:18
 */
@Service
public class CardServiceImpl implements CardService {
    @Autowired
    private CardRepository cardRepository;

    //增加
    @Override
    @Transactional
    public Result<Card> insertCard(Card card) {
        cardRepository.saveAndFlush(card);
        return new Result<Card>(
                Result.ResultStatus.SUCCESS.status,
                "insert success",card
        );
    }
}
